// 猜数字
let csz = {
  number: 0,
  cs: 0,
  handle(msg) {
    let number;
    let res;
    number = parseInt(msg);
    if (isNaN(number)) {
      res = `“${msg}”不是一个数字哦，请重新输入`;
    } else {
      res = "你猜的数字是" + number + "，";
      if (number < 0 || number > 1000) {
        res += "他不在0-1000的范围里面，请重新输入";
      } else {
        this.cs++;
        if (number < this.number) {
          res += "你猜的太小了！";
        } else if (number > this.number) {
          res += "你猜的太大了！";
        } else {
          res += "恭喜你，猜对了！你共花了" + this.cs + "次机会，你真是牛啊牛啊";
        }
      }
    }

    addLine(res, "<");
  },
  start(msg, args) {
    this.number = Math.round(Math.random() * 1000);
    addLine("欢迎来玩猜数字游戏，我已经生成了一个0-1000的数字，请输入一个数字来猜吧！", "<");
  },
};
